package com.smt.ejb3.tutoria.client;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import com.smt.ejb3.tutoria.StatefulEjb;

public class StatefulEjbClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			InitialContext ctx = new InitialContext();

			StatefulEjb ejb = (StatefulEjb) ctx
					.lookup("StatefulEjbBean/remote");
			System.out.println(ejb.get());
			ejb.add();
			System.out.println(ejb.get());
			ejb.add();
			System.out.println(ejb.get());
			ejb.add();
			System.out.println(ejb.get());
			System.out.println("------");
			StatefulEjb ejb2 = (StatefulEjb) ctx
					.lookup("StatefulEjbBean/remote");
			System.out.println(ejb2.get());
			ejb2.add();
			System.out.println(ejb2.get());
			ejb2.add();
			System.out.println(ejb2.get());
			ejb2.add();
			System.out.println(ejb2.get());

		} catch (NamingException ex) {
			ex.printStackTrace();
		}
	}

}
